#ifndef GUI_MAIN_WINDOW_HPP
#define GUI_MAIN_WINDOW_CPP

#include <widgets/main_window.hpp>

class QAction;
class QToolBar;
class QMenuBar;
class QStatusBar;
class QMenu;

namespace widgets
{
    class status_label;
}

namespace model
{
    class repository;
    typedef shared_ptr<repository> repository_ptr;
}

namespace gui
{
    class workspace;

    class main_window : public widgets::main_window
    {
        Q_OBJECT
    public:
        main_window();
        virtual ~main_window();

    private:
        widgets::status_label* status_lbl_;
        workspace* workspace_;

    signals:
        void open_repository_request(const string& path);
        void create_repository_request(const string& path);

    public slots:
        void on_application_status_change(const QString& msg);
        void on_open_repository_request();
        void on_create_repository_request();

        void on_repository_opened(model::repository_ptr p);
        void on_repository_closed();

    protected:
        virtual void setup_status_bar();
        virtual void setup_actions();
        virtual void setup_menu_bar();
        virtual void setup_tool_bar();

        QMenu* repository_menu() const
        {
            return repository_m_;
        }

        QAction* create_repository_action();
        QAction* open_repository_action();
        QAction* close_repository_action();
        QAction* save_repository_action();

        QIcon load_icon(const string& resource_path);

    private:
        widgets::status_label* info_w_;
        workspace* ws_;

        QMenu* repository_m_;
        QToolBar* repository_tb_;

        QAction* open_repository_a_;
        QAction* close_repository_a_;
        QAction* save_repository_a_;
        QAction* create_repository_a_;
    };
}

#endif
